/*
 ============================================================================
 Name        : Graph.c
 Author      : 
 Version     :
 Copyright   : Your copyright notice
 Description : Hello World in C, Ansi-style
 ============================================================================
 */

#include <stdio.h>
#include <stdlib.h>

typedef struct vnode
{
	int vex;
	struct vnode* next;
} Graph;

void createGraph(Graph* adjust,int nodeNum)
{
	Graph* s;
	int visited[nodeNum];
	int k,j,i,h=0;
	int a[]={1,2,4,4,5,4,2,4,2,4,4,2,3,0};
	int b[]={2,4,4,5,4,2,4,2,4,4,2,3,4,0};
	printf("please input the edge(i,j):");
	s=(Graph *) malloc(sizeof(struct vnode));
	s->next=NULL;
	s->vex=0;
	for(k=1;k<=nodeNum;k++) adjust[k]=*s;
	//scanf("%d %d",&i,&j);
	while(i!=0&&j!=0)
	{
		s=(Graph *) malloc(sizeof(struct vnode));
		s->next=adjust[i].next;
		adjust[i]=*s;
		s->vex=j;
		i=a[h];
		j=b[h];
		h++;
		//scanf("%d %d",&i,&j);
	}

}


void showGraph(Graph* adjust,int nodeNum)
{
	Graph* s;
	int i=0;
	for(;i<nodeNum;i++)
	{
		if(adjust[i].vex!=0)
		{
		printf(adjust[i].vex);
		s=adjust[i].next;
		while (s->vex!=0)
		{
			printf(s->vex);
			s=s->next;
		}
		}
	}
}

int main(void) {
	Graph g[6];
	createGraph(g,6);
	showGraph(g,6);
	puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */
	return EXIT_SUCCESS;
}
